package com.lins.storedisk.config.advice;

import cn.dev33.satoken.util.SaResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * 全局异常拦截 建议
 * @Author linshuo
 * @Date 2023/12/1 14:06
 */
@Slf4j
@RestControllerAdvice
public class GlobalExceptionAdvice {

    // 全局异常拦截
    @ExceptionHandler
    public SaResult handlerException(Exception e) {
//        e.printStackTrace();
//        log.error(e.getMessage(),e);
        return SaResult.error(e.getMessage());
    }

}
